package com.xiaoke.enums;

import static com.xiaoke.domain.HttpCode.*;

public enum AppHttpCodeEnum {
    // 成功
    SUCCESS(OK,"操作成功"),
    // 成功
    CREATE_SUCCESS(CREATE,"创建成功"),
    // 创建失败
    CREATE_ERROR(UNPROCESABLE_ENTITY,"数据已存在，添加失败"),
    // 修改成功
    MODIFY_SUCCESS(OK,"修改成功"),
    // 400
    QUERYEXCEPTION(BAD_REQUEST,"查询失败，数据不存在"),
    // 404
    NOTFOUND(NOT_FOUND,"资源不存在"),
    DEL_ERROR(DELETE_ERROR,"删除失败"),
    // 登录
    NO_OPERATOR_AUTH(UNAUTHORIZED,"未授权"),
    /**
     * 服务器未知错误
     */
    SYSTEM_ERROR(SERVER_EXCEPTION,"服务器未知错误");
    final int code;
    final String msg;
    AppHttpCodeEnum(int code, String errorMessage){
        this.code = code;
        this.msg = errorMessage;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

}
